<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>发光效果</title>
    <style>
        body {
            background-color: #000;
        }
        #wrap {
            width: 360px;
            margin: 100px auto;
            padding: 10px;
            border-radius: 10px;
            box-shadow: 8px 8px 10px #000 inset,-8px -8px 10px #000 inset;
        }
        #box {
            height: 170px;
            border-radius: 10px;
            text-align: center;
            line-height: 170px;
        }
        #wrap,#box,.start {
            background-repeat: repeat-x, repeat-x, repeat-x, repeat-x;
            background-position: 0 0, 0 0, 0 0, 0 0;
            background: #0a84e3 linear-gradient(to left,rgba(0,0,0,.1) 0%, rgba(150,150,150,.3) 50%, rgba(255, 229, 150, 0.3) 70%, rgba(255,231,87,.1) 90%);
        }

        div.end {
            transition-property: background-position;
            transition-duration: 20s;
            transition-timing-function: linear;
            background-position: -5400px 0, -4600px 0, -3800px 0, -3000px 0;
        }

        /*颜色变化函数*/
        @keyframes colors {
            0% {background-color: #39f;}
            15% {background-color: #F246C9;}
            30% {background-color: #4453F2;}
            45% {background-color: #44F262;}
            60% {background-color: #F257D4;}
            75% {background-color: #EDF255;}
            90% {background-color: #F20006;}
            100% {background-color: #39f;}
        }
        div.end {
            animation: colors 10s ease infinite;
        }

        form {
            border-radius: 10px;
            height: 100%;
            width: 100%;
            background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 150, from(#242424), to(#090909));
        }
        input {
            background-color: #333;
        }
    </style>
</head>
<body onload="init()">
<div id="wrap" class="start">
    <div id="box" class="start">
        <form>
            <input type="text " id="inp">
        </form>
    </div>
</div>

<script>
    var inp = document.getElementById("inp");
    var div = document.getElementsByTagName('div');
    inp.onfocus = function () {
        div[0].className = 'start end';
        div[1].className = 'start end';
    }
    inp.onblur = function () {
        div[0].className = 'start';
        div[1].className = 'start';
    }
    function init() {
      inp.focus();
    }

</script>
</body>
</html>
